<?php

/**
 * reservas actions.
 *
 * @package    complejocali.com.ar
 * @subpackage reservas
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class reservasActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->form = new ReservasForm();
      $this->datos = $request->getParameter('reservas');
      if ($request->isMethod('post'))
      {
          $this->form->bind($this->datos);
          if($this->form->isValid()){
              $body = "<h2>Mensaje enviado desde Seewald Inform&aacute;tica</h2>";
              $body.= "<div><strong>Nombre:</strong> ".$this->datos['nombre']."</div>";
              $body.= "<div><strong>Pais:</strong> ".$this->datos['pais']."</div>";
              $body.= "<div><strong>E-mail:</strong> ".$this->datos['email']."</div>";
              $body.= "<div><strong>Telefono:</strong> ".$this->datos['telefono']."</div>";
              $body.= "<div><strong>Fecha Arribo:</strong> ".$this->datos['fecha_arribo']."</div>";
              $body.= "<div><strong>Fecha Salida:</strong> ".$this->datos['fecha_salida']."</div>";
              $body.= "<div><strong>Adultos:</strong> ".$this->datos['adultos']."</div>";
              $body.= "<div><strong>Niños:</strong> ".$this->datos['ninios']."</div>";
              $body.= "<div><strong>Consulta:</strong> ".$this->datos['consulta']."</div>";

                $message = $this->getMailer()->compose(
                  array('reservas@complejocali.com.ar' => 'Reserva ~ Complejo Cali Cabañas'),
                  'complejocali@hotmail.com.ar',
                  'Formulario de Reservas ~ Complejo Cali Cabañas',
                  $body
                );
                $message->setContentType("text/html");
                $message->setReplyTo(array($this->datos['email'] => $this->datos['nombre']));

                $this->getMailer()->send($message);
                
                //$this->form = new ContactoForm();
                $this->redirect('reservas/gracias');
          }
      }
      
  }
  public function executeGracias()
  {
      
  }
}
